var weixin_share = {
    imgUrl: "",
    lineLink: window.location.href,
    descContent: "",
    shareTitle: "",
    appid: "wx26d552503e96e570",
    price: ""
};
weixin_share.init = function(params) {
    if (params.price) {
        weixin_share.price = "仅售" + params.price + "元，";
    } else {
        weixin_share.price = "";
    }
    weixin_share.imgUrl = params.share_img_url;
    weixin_share.descContent = weixin_share.price + params.share_info;
    weixin_share.shareTitle = params.share_title;
    document.addEventListener("WeixinJSBridgeReady",
    function onBridgeReady() {
        WeixinJSBridge.on("menu:share:appmessage",
        function(argv) {
            weixin_share.sharefriend()
        });
        WeixinJSBridge.on("menu:share:timeline",
        function(argv) {
            weixin_share.sharetimeline()
        });
        WeixinJSBridge.on("menu:share:weibo",
        function(argv) {
            weixin_share.shareweibo()
        })
    },
    false)
};
weixin_share.sharefriend = function() {
    WeixinJSBridge.invoke("sendAppMessage", {
        "appid": weixin_share.appid,
        "img_url": weixin_share.imgUrl,
        "img_width": "640",
        "img_height": "640",
        "link": weixin_share.lineLink,
        "desc": weixin_share.descContent,
        "title": weixin_share.shareTitle
    },
    function(res) {
        _report("send_msg", res.err_msg)
    })
};
weixin_share.sharetimeline = function() {
    WeixinJSBridge.invoke("shareTimeline", {
        "img_url": weixin_share.imgUrl,
        "img_width": "640",
        "img_height": "640",
        "link": weixin_share.lineLink,
        "desc": weixin_share.descContent,
        "title": weixin_share.descContent
    },
    function(res) {
        _report("timeline", res.err_msg)
    })
};
weixin_share.shareweibo = function() {
    WeixinJSBridge.invoke("shareWeibo", {
        "content": weixin_share.descContent,
        "url": weixin_share.lineLink,
    },
    function(res) {
        _report("weibo", res.err_msg)
    })
};